package com.bdqn.service.impl;

import com.bdqn.entity.Employee;
import com.bdqn.mapper.EmployeeMapper;
import com.bdqn.param.response.Page;
import com.bdqn.service.EmployeeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 员工信息 服务实现类
 * </p>
 *
 * @author hunter
 * @since 2022-06-11
 */
@Service
public class  EmployeeServiceImpl extends ServiceImpl<EmployeeMapper, Employee> implements EmployeeService {
  @Autowired
  private EmployeeMapper employeeMapper;
//    @Override
//    public Employee login(String username, String password) {
//        return employeeMapper.login(username,password);
//    }

  @Override
  public Employee checkUsername(String username) {
    return employeeMapper.checkUsername(username) ;
  }

  @Override
  public Page<Employee> pageInfo(Integer page, Integer pageSize,String name) {
    //分页操作
    PageHelper.startPage(page,pageSize);
    //查询所有的用户数据
    List<Employee> selectList = employeeMapper.selectList(name);
    PageInfo pageInfo=new PageInfo(selectList);
    //封装分页对象
    return new Page(pageInfo.getPageNum(),pageInfo.getPageSize(),pageInfo.getTotal(),pageInfo.getList());
   }

  @Override
  public Employee checkName(String name) {
    return employeeMapper.checkName(name);
  }

}
